package com.coderman.infosys.auth.app.facadeimpl.authority;

import com.coderman.infosys.auth.app.convert.AuthorityConvert;
import com.coderman.infosys.auth.domain.bo.authority.AuthorityBO;
import com.coderman.infosys.auth.domain.gataway.AuthorityQueryGataWay;
import com.coderman.infosys.plat.auth.common.dto.PageDTO;
import com.coderman.infosys.plat.auth.common.dto.ResultDataDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.coderman.infosys.auth.api.facade.authority.AuthorityQueryFacade;
import com.coderman.infosys.auth.api.dto.authority.AuthorityDTO;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


/**
 * @Description:接口实现类
 * @Author：
 * @CreateTime：2022-01-02 15:27:39
 * @version v1.0
 */
@Service
public class AuthorityQueryFacadeImpl   implements AuthorityQueryFacade{

	private  Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    public AuthorityQueryGataWay authorityQueryGataWay;


    @Override
    public ResultDataDto<AuthorityDTO> checkUserSystemAuth(Long userId, String systemCode){

        return null;
    }

    @Override
    public ResultDataDto<AuthorityDTO> getUserSystemAuth(Long userId,String systemCode){

        return null;
    }

    @Override
    public ResultDataDto<AuthorityDTO> getByCode(String authCode){
        AuthorityBO authorityBO = authorityQueryGataWay.getByAuthCode("",authCode);
        AuthorityDTO authorityDTO = AuthorityConvert.INSTANCE.bo2dto(authorityBO);

        return ResultDataDto.success(authorityDTO);
    }

    @Override
    public ResultDataDto<PageDTO> getPageList(PageDTO pageDTO){
        List<AuthorityBO> authorityBOList = authorityQueryGataWay.getPageList(pageDTO.convertToBO());
        List<AuthorityDTO> authorityDTOList = AuthorityConvert.INSTANCE.authorityBOs2dtoList(authorityBOList);
        return ResultDataDto.success(pageDTO.setItems(authorityDTOList));
    }

}